from re import S
from manimlib import *
#75cfb8
#bbdfc8
#f0e5d8
#ffc478
# class p1(Scene):
#     def construct(self):
#         s1=Square(6)
#         s2=Square(3).rotate(-80*DEGREES)
#         for i in range(4):
#             t=0.25*i
#             self.add(Line(s1.point_from_proportion(t),s2.point_from_proportion(t)))
#         self.add(s1,s2)
#         # animate
#         self.wait()
class p1(Scene):
    def construct(self):
        # self.add(NumberPlane())
        l6=Line(DL*3,DR*3)
        angle=PI/7
        l1=Line(UP*4).rotate(-angle).next_to(l6.get_left(),UR,buff=0).set_color('#75cfb8')
        l2=Line(UP*4).rotate(PI/2-angle).next_to(l6.get_right(),UL,buff=0).set_color('#75cfb8')
        l=Line(l2.point_from_proportion(0),l1.point_from_proportion(0))
        p=VGroup(l6,l1,l2,l)
        self.add(p,
            Tex('10').next_to(l6,DOWN),
            Tex('6').next_to(l,buff=-0.3),
            Tex('A').next_to(l6,LEFT),
            Tex('B').next_to(l6),
            Tex('C').move_to([-0.8,-1.9,0]),
            Tex('D').next_to(l1,UP),
            Tex(r'\angle A+\angle B=90^\circ').shift(UR),
            Tex('AD=BC').shift(RIGHT),
            Tex(r'S_{ABCD}=?').shift(DR)
        )
        # animate
        self.wait()
class p2(Scene):
    def construct(self):
        l6=Line(DL*3,DR*3)
        angle=PI/7
        l1=Line(UP*4).rotate(-angle).next_to(l6.get_left(),UR,buff=0).set_color('#75cfb8')
        l2=Line(UP*4).rotate(PI/2-angle).next_to(l6.get_right(),UL,buff=0).set_color('#75cfb8')
        l=Line(l2.point_from_proportion(0),l1.point_from_proportion(0))
        p=VGroup(l6,l1,l2,l)
        for i in range(4):
            # self.play(TransformFromCopy(p,p.copy().rotate_about_origin(i*PI/2)))
            self.play(Rotating(p.copy(),about_point=ORIGIN,radians=i*PI/2),run_time=1)
        # animate
        self.wait()
class p3(Scene):
    def construct(self):
        o,a,b=[0,-2,0],[3,1,0],[5,0,0]
        p=VGroup(Line(o,a),Line(o,b),Line(a,b))
        self.add(p,p.copy().rotate(PI/1.6,about_point=o),Arc(0.5,PI/4,PI/1.6,9,o))
        self.add(
            Tex('O').next_to(o,DOWN),
            Tex('A').next_to(a,UP),
            Tex('B').next_to(b),
            Tex('A^\prime').move_to([-4,-0.8,0]),
            Tex('B^\prime').move_to([-4,2,0])
        )